package top.noteday.controller;

import java.util.List;
import java.util.Date;
import entity.Page;
import entity.result.EntityResult;
import org.springframework.beans.factory.annotation.Autowired;
import entity.result.PageResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.PostMapping;
import entity.form.*;
import top.noteday.impl.FormServiceImpl;

@RestController
@RequestMapping(value = "/backstage/form")
public class FormServiceController {

    @Autowired
    private FormServiceImpl formService;

    /**
     * 查询一个
     */
    @PostMapping(value = "/selectById")
    public Form selectById(@RequestParam("id") Integer id) {
        return formService.selectById(id);
    }

    /**
     * 保存表单模板
     */
    @PostMapping(value = "/saveFormTemplate")
    public EntityResult<FormDto> saveFormTemplate(@RequestBody FormVo vo) {
        return formService.saveFormTemplate(vo);
    }

    /**
     * 获取表单模板
     */
    @PostMapping(value = "/getFormTemplate")
    public EntityResult<FormDto> getFormTemplate(@RequestBody FormVo vo) {
        return formService.getFormTemplate(vo);
    }

    /**
     * 提交表单
     */
    @PostMapping(value = "/submitForm")
    public EntityResult<FormDto> submitForm(@RequestBody FormVo vo) {
        return formService.submitForm(vo);
    }

    /**
     * 分页查询
     */
    /*
    @PostMapping(value = "/selectForm")
    PageResult<FormDto> selectForm(@RequestBody FormVo formVo) {
        return formService.selectForm(formVo);
    }
    */
}
